Scourge = class('Scourge', Feature)

function Scourge:initialize(name, image, x, y, rotation, text, damage, anim)

	self.researched = false
	self.t = "scourge"
	self.anim = anim or scg_anim:clone()
	self.visible = false

	Hazard.initialize(self, name, image, x, y, rotation, text, damage, self.t, self.visible)


end

function Scourge:research()
	--print (self.researched)

	if self.researched == false then -- researching scourge gives bonuses against them

		player.scourge_res = player.scourge_res + 1

		local r = RNG:random(scourge_anim_frames)

		table.insert(anims, { x = self.x,
								y = self.y, anim = self.anim, t = self.t })

		self.image = scourge_fin_img

		self.researched = true
	else

	end

end

function Scourge:use()

	self:draw_text()
	p_damage(self.damage, player.resist)

end

function Scourge:generate(Points) -- place scourge around Points

	for i = 1, #Points do

		local r = RNG:random(scourge_anim_frames)

		local scrge = Scourge:new("scourge "..i, scourge_imgs[r],
			Points[i].x, Points[i].y, 0, "Your skin welts and burns.", 50)

		if r == scourge_anim_frames then

			scrge.researched = true

		end



	end

end

function Scourge:update()

	Feature.update(self)

end


function Scourge:walls(scg, grid)

	-- randomly apply scourge to walls for decoration

	for y = 1, map_h do
		if grid[y] then
			for x = 1, map_w do
				if grid[y][x] then

					if grid[y][x] == wall_tile then

						local r = RNG:random(100)

						if r < 60 then
							scg[#scg+1] = {
								x = x,
								y = y
							}


						end

					end

				end


			end

		end
	end

end


